import request from '@/plugins/request'
import { IResponseData } from '@/types/request-base'
import { json2FormData } from '@/utils'

// 区域相关接口

/**
 * 验收区域保存 AMID为00000000-0000-0000-0000-000000000000新增
 * @param {string} data  保存参数对象
 */
export function saveModule(data: any) {
  if (!data.amid) {
    data.amid = '00000000-0000-0000-0000-000000000000'
  }
  return request<IResponseData>({
    method: 'POST',
    url: `/app/TaskManage/SaveAcceptModule`,
    data,
    headers: {
      repeatSubmit: false
    },
    loading: true,
    errorShow: true
  })
}

/**
 * 删除验收区域信息
 * @param {string} amid  验收区域id
 */
export function deleteModule(amid: any) {
  return request<IResponseData>({
    method: 'POST',
    url: `/app/TaskManage/DeleteAcceptModule?guid=${amid}`,
    errorShow: true
  })
}

/**
 * 查询单个验收区域详情
 * @param {string} caid 验收ID
 */
export function queryModuleDetail(amid: string) {
  return request<IResponseData>({
    method: 'get',
    url: `/app/TaskManage/GetAcceptModule?amid=${amid}`
  })
}
